<?php

if( class_exists( 'kdMultipleFeaturedImages' ) ) {
  $types = [
    array(
        'id' => 'thumbnail',
        'post_type' => 'post',      // Set this to post or page
        'labels' => array(
            'name'      => '缩略图',
            'set'       => '设置缩略图',
            'remove'    => '移除缩略图',
            'use'       => '用作缩略图',
        )
    ),
    array(
      'id' => 'slide-picture',
      'post_type' => 'post',      // Set this to post or page
      'labels' => array(
          'name'      => '轮播大图',
          'set'       => '设置轮播大图',
          'remove'    => '移除轮播大图',
          'use'       => '用作轮播大图',
      )
    )
  ];


  foreach($types as $arg){
    new kdMultipleFeaturedImages( $arg );
  }
}

add_action('admin_menu', 'add_gcf_interface');

function add_gcf_interface() {
  add_options_page('Global Custom Fields', '全局常量配置', '8', 'global_config', 'editglobalcustomfields');
}

function editglobalcustomfields() {
  ?>
  <div class='wrap'>
  <h2>全局常量配置</h2>
  <form method="post" action="options.php">
  <?php wp_nonce_field('update-options') ?>
  
  <p><strong>电话:</strong><br />
  <input type="text" name="cb_telephone" size="45" value="<?php echo get_option('cb_telephone'); ?>" /></p>

  <p><strong>地址:</strong><br />
  <input type="text" name="cb_address" size="45" value="<?php echo get_option('cb_address'); ?>" /></p>
  
  <p><strong>微博ID:</strong><br />
  <input type="text" name="cb_weiboid" size="45" value="<?php echo get_option('cb_weiboid'); ?>" /></p>

  <p><strong>微信ID:</strong><br />
  <input type="text" name="cb_wechatid" size="45" value="<?php echo get_option('cb_wechatid'); ?>" /></p>

  <p><input type="submit" name="Submit" value="保存更改" class="button button-primary" /></p>

  <input type="hidden" name="action" value="update" />
  <input type="hidden" name="page_options" value="cb_telephone,cb_address,cb_weiboid,cb_wechatid" />

  </form>
  </div>
  <?php
}




